package com.woniuxy.demo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author 佘赛飞
 * @create 2021 -10 -07 3:37 PM
 */
@Component
@Data
@AllArgsConstructor
@NoArgsConstructor
//这个注解是告诉框架；去配置文件中查找所有以student前缀开头的配置文件属性
//如果这个前缀开头的属性名和当前对象的属性名一致，将配置文件的属性值作为这个bean的属性值
@ConfigurationProperties(prefix = "student")
//指定框架读取自定义配置文件
@PropertySource("classpath:student.properties")
public class Student {
    private String sname;
    private Integer age;
}
